<script setup lang="ts">

import SvgIcon from "@/components/common/SvgIcon.vue";
import {PropType} from "vue";
import dateUtils from "@/utils/dateUtils.ts";

defineProps({
  album: Object as PropType<AlbumVO>
})
</script>

<template>
  <div class="album-card">
    <img v-lazy="album?.cover" alt="">
    <div class="album-info">
      <div class="album-time">
        <SvgIcon class-name="icon" icon-class="发布日期" />
        <span class="album-time-date">{{ dateUtils(album?.createTime).format("YYYY-MM-DD") }}</span>
      </div>
      <div class="album-statistics">
        <ul>
          <li>
            <SvgIcon class-name="icon" icon-class="点赞白" />
            9999+
          </li>
          <li>
            <SvgIcon class-name="icon" icon-class="浏览量" />
            9999+
          </li>
        </ul>
      </div>
    </div>
    <div class="album-mask">
      <div class="album-title">{{ album?.albumName }}</div>
      <div class="album-author">
        <SvgIcon class-name="icon" icon-class="user" />
        <span>{{ album?.userName }}</span>
      </div>
      <p class="album-content">{{ album?.description }}</p>
      <div class="album-tag">
      </div>
    </div>
  </div>
</template>

<style scoped lang="less">
.album-card {
  width: 612px;
  height: 380px;
  border-radius: 4px;
  overflow: hidden;
  color: #fff;
  position: relative;
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  &:hover{
    .album-mask {
      opacity: 1; /* 悬浮时显示蒙版 */
    }
    .album-info  {
      opacity: 0; /* 悬浮时隐藏信息 */
    }
  }
}
.album-info {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 54px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6); /* 半透明黑色背景 */
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 400;
  font-size: 18px;
  line-height: 20px;
  .album-time{
    display: flex;
    align-items: center;
  }
  .album-statistics{
    ul{
      display: flex;
      list-style: none;
      li{
        display: flex;
        align-items: center;
        margin-right: 24px;
        .icon{
          width: 16px;
          height: 16px;
          margin-right: 8px;
        }
      }
    }
  }
}
.album-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6); /* 半透明黑色背景 */
  backdrop-filter: blur(32px);
  opacity: 0; /* 默认隐藏 */
  transition: opacity 0.3s ease; /* 透明度过渡 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  //row-gap: 26px;
  .album-title{
    height: 28px;
    font-weight: 500;
    font-size: 20px;
    line-height: 27px;
  }
  .album-author{
    display: flex;
    .icon{
      width: 20px;
      height: 20px;
    }
    margin-top: 16px;
    height: 20px;
    font-weight: 400;
    font-size: 14px;
    line-height: 19px;
  }
  .album-content{
    margin-top: 26px;
    width: 516px;
    height: 74px;
    white-space: nowrap; /* 禁止换行 */
    overflow: hidden; /* 隐藏超出部分 */
    text-overflow: ellipsis; /* 添加省略号 */
    font-weight: 400;
    font-size: 14px;
    line-height: 19px;
    text-align: center;
  }
}
</style>
